<?

class graphInterfaceTraffic extends graphBase {	
	public function __construct($device,$params=array()) {		
		if (is_array($params) || is_object($params)) {
			foreach ($params AS $name=>$value) {
				switch ($name) {
					case 'index': 
						$this->rrdFile = 'interface_'.(int)$value.'.rrd';
						break;
				}
			}
		}
		parent::__construct($device,$params);
	}
	protected function getOptions() {
		return array(
			'DEF:outoctets='.$this->rrdPath.':OUTOCTETS:AVERAGE',
			'DEF:inoctets='.$this->rrdPath.':INOCTETS:AVERAGE',
			'DEF:outoctets_max='.$this->rrdPath.':OUTOCTETS:MAX',
			'DEF:inoctets_max='.$this->rrdPath.':INOCTETS:MAX',
			'CDEF:octets=inoctets,outoctets,+',
			'CDEF:doutoctets=outoctets,-1,*',
			'CDEF:inbits=inoctets,8,*',
			'CDEF:inbits_max=inoctets_max,8,*',
			'CDEF:outbits_max=outoctets_max,8,*',
			'CDEF:doutoctets_max=outoctets_max,-1,*',
			'CDEF:doutbits_max=doutoctets_max,8,*',
			'CDEF:outbits=outoctets,8,*',
			'CDEF:doutbits=doutoctets,8,*',
			'VDEF:totin=inoctets,TOTAL',
			'VDEF:totout=outoctets,TOTAL',
			'VDEF:tot=octets,TOTAL',
			'AREA:doutbits_max#a3b9FF:',
			'AREA:doutbits#C3D9FF:',
			'LINE1.25:doutbits#000099:Out','GPRINT:outbits:LAST:%6.2lf%s','GPRINT:outbits:AVERAGE:%6.2lf%s','GPRINT:outbits_max:MAX:%6.2lf%s','GPRINT:totout:%6.2lf%s\n',
			'AREA:inbits_max#006600:',
			'AREA:inbits#CDEB8B:',
			'LINE1.25:inbits#006600:In','GPRINT:inbits:LAST: %6.2lf%s','GPRINT:inbits:AVERAGE:%6.2lf%s','GPRINT:inbits_max:MAX:%6.2lf%s','GPRINT:totin:%6.2lf%s\n',
			'COMMENT:BPS      Now       Ave      Max      Total\n'
		);
	}
}